import {queryCityMenu, queryNucleicAcidByCity} from "@/api"

const state = {
  cityMenu:{},
  
  nucleAcidInfos:[],

  loading:false
}

const mutations = {
  CITYMENU(context, data){
    context.cityMenu = data
  },

  NUCLEACIDINFOS(context, data){
    context.nucleAcidInfos = data
  },

  LOADING(context, flag){
    context.loading = flag
  }
}

const actions = {
  async cityMenu({commit}){
    let result = await queryCityMenu()
    commit('CITYMENU',result.data)
  },

  async nucleAcidInfos({commit}, city){
    commit("LOADING",true)
    let result = await queryNucleicAcidByCity(city)
    commit('NUCLEACIDINFOS',result.data)
    commit("LOADING",false)
  }
}

const getters = {}

export default {
  state,
  mutations,
  actions,
  getters
}